<template name="my-course-arrange">
	<view>
		<scroll-view :scroll-y="modalName==null" class="page" :class="modalName!=null?'show':''">
			<cu-custom bgColor="bg-gradual-pink" :isBack="true">
				<block slot="content">我的课表</block>
			</cu-custom>
			
			<!-- 我的课表 -->
			<view class="cu-bar bg-white solid-bottom" :style="[{animation: 'show 0.5s 1'}]">
				<view class="action">
					<text class='cuIcon-title text-blue'></text>当前课表为教师个人课表预览
				</view>
			</view>
			<view class="cu-bar bg-white solid-bottom" :style="[{animation: 'show 0.5s 1'}]">
				<view class="action">
					<view class="cu-list grid col-7 text-sm">
						<view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]">
							<view class="text-center" style="width:47px;height: 25px;background-color: antiquewhite;">
								<view class="margin-top-xs">节次</view>
							</view>
							<view class="text-center" style="width:47px;height: 25px;background-color: antiquewhite;" v-for="(item,index) in courseData1" :key="index">
								<view class="margin-top-xs" style="font-size: 10px;">{{item.courArraAtomSectionname}}</view>
							</view>
						</view>
						
						<view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]">
							<view class="text-center" style="width:47px;height: 25px;background-color: antiquewhite;">
								<view class="margin-top-xs">周一</view>
							</view>
							<view class="text-center" style="width:47px;height: 25px;" v-for="(item,index) in courseData1" :key="index">
								<view class="margin-top-xs" style="font-size: 10px;">{{item.subjectName}}</view>
							</view>
						</view>
						
						<view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]">
							<view class="text-center" style="width:47px;height: 25px;background-color: antiquewhite;">
								<view class="margin-top-xs">周二</view>
							</view>
							<view class="text-center" style="width:47px;height: 25px;" v-for="(item,index) in courseData2" :key="index">
								<view class="margin-top-xs" style="font-size: 10px;">{{item.subjectName}}</view>
							</view>
						</view>
						
						<view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]">
							<view class="text-center" style="width:47px;height: 25px;background-color: antiquewhite;">
								<view class="margin-top-xs">周三</view>
							</view>
							<view class="text-center" style="width:47px;height: 25px;" v-for="(item,index) in courseData3" :key="index">
								<view class="margin-top-xs" style="font-size: 10px;">{{item.subjectName}}</view>
							</view>
						</view>
						
						<view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]">
							<view class="text-center" style="width:47px;height: 25px;background-color: antiquewhite;">
								<view class="margin-top-xs">周四</view>
							</view>
							<view class="text-center" style="width:47px;height: 25px;" v-for="(item,index) in courseData4" :key="index">
								<view class="margin-top-xs" style="font-size: 10px;">{{item.subjectName}}</view>
							</view>
						</view>
						
						<view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]">
							<view class="text-center" style="width:47px;height: 25px;background-color: antiquewhite;">
								<view class="margin-top-xs">周五</view>
							</view>
							<view class="text-center" style="width:47px;height: 25px;" v-for="(item,index) in courseData5" :key="index">
								<view class="margin-top-xs" style="font-size: 10px;">{{item.subjectName}}</view>
							</view>
						</view>
						
						<view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]">
							<view class="text-center" style="width:47px;height: 25px;background-color: antiquewhite;">
								<view class="margin-top-xs">周六</view>
							</view>
							<view class="text-center" style="width:47px;height: 25px;" v-for="(item,index) in courseData6" :key="index">
								<view class="margin-top-xs" style="font-size: 10px;">{{item.subjectName}}</view>
							</view>
						</view>
						
						<view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]">
							<view class="text-center" style="width:47px;height: 25px;background-color: antiquewhite;">
								<view class="margin-top-xs">周天</view>
							</view>
							<view class="text-center" style="width:47px;height: 25px;" v-for="(item,index) in courseData7" :key="index">
								<view class="margin-top-xs" style="font-size: 10px;">{{item.subjectName}}</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			
			<!-- 现实选择 -->
			<view class="cu-bar bg-white solid-bottom" :style="[{animation: 'show 0.5s 1'}]">
				<view class="uni-padding-wrap uni-common-mt" style="padding: 15px;">
					<button style="background-color: #007aff;border: none;line-height: 40px;" type="primary">查 看科 目</button>
				</view>
				<view class="uni-padding-wrap uni-common-mt" style="padding: 15px;">
					<button style="background-color: #e64340;border: none;line-height: 40px;" type="primary">查 看教 师</button>
				</view>
				<view class="uni-padding-wrap uni-common-mt" style="padding: 15px;">
					<button style="background-color: #14a563;border: none;line-height: 40px;" type="primary">查 看班 级</button>
				</view>
				<view class="uni-padding-wrap uni-common-mt" style="padding: 15px;">
					<button style="background-color: #8aa514;border: none;line-height: 40px;" type="primary">查 看教 室</button>
				</view>
			</view>
			
		</scroll-view>
		<view class="cu-tabbar-height margin-top"></view>
	</view>
</template>

<script>
	import api from '@/api/api'
	import { ACCESS_TOKEN,USER_NAME,USER_INFO } from "@/common/util/constants"
	
	export default {
		name: 'my-course-arrange',
		props:{
			cur:String,
		},
		watch: {
			//初始化是执行
			cur: {
				immediate: true,
				handler:function(){
				    
				},
			},
		},
		data() {
			return {
				queryParam:{
					teacherId: null,
				},
				//教师个人课表数据
				courseData1: [],
				courseData2: [],
				courseData3: [],
				courseData4: [],
				courseData5: [],
				courseData6: [],
				courseData7: [],
				url: {
					//教师个人课表（冲突检测课表）
					teacherCourseArrangeAtomList: "/coursearrangeatom/couCourseArrangeAtom/getArrangeAtomByObjId",
				},
				//租户ID
				userInfo: {},
			}
		},
		onLoad() {
			console.log("====用户信息===== ")
			this.userInfo = uni.getStorageSync(USER_INFO)
			console.log(this.userInfo.tenantId)
			//调用课表查询方法
			this.getTeacherCourseArrange();
		},
		methods: {
			//教师个人课表数据
			getTeacherCourseArrange(){
				let params = {
					teacherId : null,
					checkContradiction : 0,
					courseArrangeId: null,
					classId: null,
					tenantId: this.userInfo.tenantId,
				}
				this.$http.get(this.url.teacherCourseArrangeAtomList, params).then(res=>{
					//console.log("res::",res.data)
				  if(res.data.success){
					console.log("res::",res.data.result)
					let datas = res.data.result
					//this.courseData1 = datas
					datas.forEach((item,index)=>{    //js遍历数组
						if(item.courArraAtomWeekday === 1){
							this.courseData1.push(item)
						}
						if(item.courArraAtomWeekday === 2){
							this.courseData2.push(item)
						}
						if(item.courArraAtomWeekday === 3){
							this.courseData3.push(item)
						}
						if(item.courArraAtomWeekday === 4){
							this.courseData4.push(item)
						}
						if(item.courArraAtomWeekday === 5){
							this.courseData5.push(item)
						}
						if(item.courArraAtomWeekday === 6){
							this.courseData6.push(item)
						}
						if(item.courArraAtomWeekday === 7){
							this.courseData7.push(item)
						}
					});
				  }else{
					  this.$tip.error(res.data.message); 
				  }
				})
			},
		}
	}
</script>

<style>

</style>
